package com.example.models;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;

//@ApiModel(value="Users Entity", description = "A user entity!!")
@Entity
public class Users {
//	@ApiModelProperty(value="users id")
	@Id
	@NotNull
	@Size(min=6, max=40, message = "The user username must have between 6 and 40 characters")
	private String username;
	
	@NotNull
	@Size(min=6, message = "The user password must have at least 6 characters")
	private String password;
	private boolean enabled;
	
	public Users(){}
	
	

	public Users(String username, String password, boolean enabled) {
		super();
		this.username = username;
		this.password = new BCryptPasswordEncoder().encode(password);
		this.enabled = enabled;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}
	
	

}
